<!DOCTYPE html>
<html lang="zh_CN">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div id="demo"></div>


	<script type="text/javascript">
		// 3:fn提供一个init方法，获取元素
		var A = function(selector) {
		    return A.fn.init(selector);
		}
		A.fn = A.prototype = {
		    init: function(selector) {
		        return document.getElementById(selector);
		    },
		    length: 2,
		    size: function() {
		        return this.length;
		    }
		}
		console.log(A('demo'));
	</script>
</body>
</html>